package chapter23.homework03;

public class Primary extends State {
    public Primary(Player player){
        //玩家的初始状态
        this.rankName = "新手";
        this.player = player;
        point = 0;
    }

    public Primary(State state){
        //玩家的初始积分0
        this.rankName = "新手";
        this.player = state.player;
        point = state.point;
    }

    @Override
    public void checkState(int point) {
        if(100 <= point  && point < 1000){
            player.setState(new Killer(this));//将过关后的状态进行传入下一级
        }
    }

    @Override
    public void LeavingMessage() {
        System.out.println(rankName + "用户留言" + player.getName() + "积分翻倍+30 ");
        //实现积分翻倍，进入下一关...
        point += 30;
        checkState(point);
    }

    @Override
    public void reply() {//回复
        System.out.println(rankName + "用户回复消息..." );
    }

    @Override
    public void download() {//下载
        if (point < 0){
            System.out.println("无法下载文件...");
        }
        int count = 10;
        point -= count / 2;
        System.out.println(rankName + "下载文件后积分还剩" + point);
    }
}
